<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
    <script>
        function kai(){
            var obj=document.getElementById("img");
            obj.src="img/on.gif";
        }
        function guan(){
            var obj=document.getElementById("img");
            obj.src="img/off.gif"
        }
    </script>
<body>
    <img src="img/off.gif" onmouseout="guan()" onmouseover="kai()" id="img">
</body>
</html>